package com.javaweb.admin.controller;

import com.javaweb.common.common.BaseController;
import com.javaweb.common.utils.JsonResult;
import com.sphsine.bip.IBIPService;
import com.sphsine.bip.ManualSyncReportParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/bipservice")
public class BIPController extends BaseController {

    @Autowired
    private IBIPService bipService;

    @PostMapping("/sendorder")
    public JsonResult sendorder(@RequestBody String body) {
        //String body = JSON.toJSONString(entity);
        return bipService.callEsb(body,"E9BO01");
    }

    @PostMapping("/sendbudget/{annualbudgetId}")
    public JsonResult sendbudget(@PathVariable("annualbudgetId") Integer annualbudgetId) {
        //String body = JSON.toJSONString(entity);
        return bipService.sendBudget("",annualbudgetId);
    }
    @PostMapping("/sendnotice/{noticeId}")
    public JsonResult sendnotice(@PathVariable("noticeId") Integer noticeId) {
        //String body = JSON.toJSONString(entity);
        return bipService.sendNotice("",noticeId);
    }

    @PostMapping("/AcquisitionPlanReport")
    public JsonResult AcquisitionPlanReport(@RequestBody String body) {
        //String body = JSON.toJSONString(entity);
        return bipService.getPlanReport(body);
    }

    @PostMapping("/manualsyncreport")
    public JsonResult manualsyncreport(@RequestBody ManualSyncReportParam reportParam) {
        //String body = JSON.toJSONString(entity);
        return bipService.manualSyncReport(reportParam.getYearly(),reportParam.getMonthly());
    }

    @PostMapping("/syncVatInvoice")
    public JsonResult syncVatInvoice() {
        //String body = JSON.toJSONString(entity);
        bipService.syncVatInvoice("1528");
        bipService.syncVatInvoice("1529");
        return bipService.syncVatInvoice("1173");
    }
}

